| <?xml version="1.0"?>
| <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
| <?xml-stylesheet href="chrome://zotero-platform/content/zotero.css"?>
| <?xml-stylesheet href="chrome://global/skin/global.css"?>
| <?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css"?>
| <?xml-stylesheet href="chrome://zotero/skin/preferences.css"?>
| <?xml-stylesheet href="chrome://zotero/skin/zotero.css"?>
| <?xml-stylesheet href="chrome://zotero-platform/content/overlay.css"?>
| <?xml-stylesheet href="chrome://zotero-better-bibtex/content/skin/preferences.css"?>
| <?xml-stylesheet href="chrome://zotero-better-bibtex/content/skin/error-report.css" type="text/css"?>
| <!DOCTYPE window [
|   <!ENTITY % ZoteroDTD SYSTEM "chrome://zotero/locale/zotero.dtd"> %ZoteroDTD;
|   <!ENTITY % BBTDTD SYSTEM "chrome://zotero-better-bibtex/locale/zotero-better-bibtex.dtd"> %BBTDTD;
|   <!ENTITY % standaloneDTD SYSTEM "chrome://zotero/locale/standalone.dtd"> %standaloneDTD;
| ]>
wizard#better-bibtex-error-report(
    xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'
    xmlns:html='http://www.w3.org/1999/xhtml'
    title='&better-bibtex_error-report.title;' _width='700' _height='700'
  )
  wizardpage(hidden=true pageid='page-enable-debug' label=' ')
    description.header(style='white-space: pre-wrap;') &better-bibtex_error-report_enable-debug;
    vbox
      button(label='&better-bibtex_error-report_restart-with-logging-enabled.label;' oncommand='window.ErrorReport.restartWithDebugEnabled()')/

  wizardpage(hidden=true pageid='page-upgrade' label=' ')
    html:div
      html:p#better-bibtex-report-upgrade-bbt(data-l10n-id='better-bibtex_error-report_upgrade')
      html:p#better-bibtex-report-upgrade-zotero(data-l10n-id='better-bibtex_error-report_upgrade')
      html:p#better-bibtex-report-upgrade-zotero_auto(hidden=true data-l10n-id='better-bibtex_error-report_upgrade_auto')
      html:p#better-bibtex-report-upgrade-zotero_manual(hidden=true data-l10n-id='better-bibtex_error-report_upgrade_manual')

  wizardpage(hidden=true pageid='page-items' label=' ')
    html:div
      html:p#better-bibtex-report-no-items(data-l10n-id='better-bibtex_error-report_no_items')
      html:ul
        html:li(data-l10n-id='better-bibtex_error-report_no_items_cancel')
        html:li(data-l10n-id='better-bibtex_error-report_no_items_reproduce')
        html:li(data-l10n-id='better-bibtex_error-report_no_items_select')
        html:li(data-l10n-id='better-bibtex_error-report_no_items_popup')
        html:li(data-l10n-id='better-bibtex_error-report_no_items_report')

  wizardpage(pageid='page-review' label=' ')
    tooltip#better-bibtex-error-report-info &better-bibtex_error-report_review;

    label#better-bibtex-report-cache(data-l10n-id='better-bibtex_error-report_better-bibtex_cache' flex='1' readonly='true')

    checkbox.better-bibtex-error-report-facet#better-bibtex-error-report-include-errors(checked=true label='&better-bibtex_error-report_include-errors.label;')/
    checkbox.better-bibtex-error-report-facet#better-bibtex-error-report-include-log(checked=true label='&better-bibtex_error-report_include-log.label;')/

    html:fieldset
      html:legend &better-bibtex_error-report_include-items.label;
      checkbox.better-bibtex-error-report-facet#better-bibtex-error-report-include-notes(checked=true label='&better-bibtex_error-report_include-notes.label;')/
      checkbox.better-bibtex-error-report-facet#better-bibtex-error-report-include-attachments(checked=true label='&better-bibtex_error-report_include-attachments.label;')/
      checkbox.better-bibtex-error-report-facet#better-bibtex-error-report-include-cache(checked=true label='&better-bibtex_error-report_include-cache.label;')/

    tabbox.debug-on(flex='10')
      tabs
        tab#better-bibtex-error-context-tab(label='&better-bibtex_error-report_context.label;')/
        tab#better-bibtex-error-errors-tab(label='&better-bibtex_error-report_errors.label;')/
        tab#better-bibtex-error-log-tab(label='&better-bibtex_error-report_debug.label;')/
        tab#better-bibtex-error-items-tab(label='&better-bibtex_error-report_items.label;')/
      tabpanels(flex='1')
        tabpanel(flex='1' orient='vertical')
          textbox#better-bibtex-error-context.plain(readonly='true' multiline='true' flex='10' style='min-height: 8em;' tooltip='better-bibtex-error-report-info')
        tabpanel(flex='1' orient='vertical')
          textbox#better-bibtex-error-errors.plain(readonly='true' multiline='true' flex='10' style='min-height: 8em;' tooltip='better-bibtex-error-report-info')
        tabpanel(flex='1' orient='vertical')
          textbox#better-bibtex-error-log.plain(readonly='true' multiline='true' flex='10' style='min-height: 8em;' tooltip='better-bibtex-error-report-info')
        tabpanel(flex='1' orient='vertical')
          textbox#better-bibtex-error-items.plain(readonly='true' multiline='true' flex='10' style='min-height: 8em;' tooltip='better-bibtex-error-report-info')
    hbox
      button(label='&better-bibtex_error-report_save.label;' oncommand='window.ErrorReport.save()')/
      hbox(flex='1')/
    html:div#better-bibtex-error-send-reminder(data-l10n-id='better-bibtex-error-send-reminder')

  wizardpage(pageid='page-send' label=' ')
    description &better-bibtex_error-report_submission-in-progress;

  wizardpage(pageid='page-done' label=' ')
    description &better-bibtex_error-report_submitted;
    description#better-bibtex-report-result
      description
        | &better-bibtex_error-report_report-id; 
        textbox#better-bibtex-report-id.plain.textbox-emph(flex='1' size=40 readonly='true')
    html:div(data-l10n-id='better-bibtex_error-report_post-to-github')
    html:a(
      href='https://github.com/retorquere/zotero-better-bibtex/issues'
      onclick='Zotero.launchURL("https://github.com/retorquere/zotero-better-bibtex/issues/new/choose")'
      ) https://github.com/retorquere/zotero-better-bibtex/issues

  script(src='chrome://zotero/content/include.js')
  script.
    window.addEventListener('load', function() {
      Zotero.BetterBibTeX.ErrorReport.load(window).catch(err => Zotero.debug(`BBT.ErrorReport: error: ${err}\n${err.stack}`))
    })
